<!-- Inicio Codigo feo para FB-->
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/es_LA/all.js#xfbml=1&appId=151090545023142";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script type="text/javascript">
	$(document).ready(function() {
            $('.fancybox-media').fancybox({
              openEffect	: 'elastic',
              closeEffect	: 'elastic',
		helpers : {
			media : {}
		},
              //padding     : 0,
              margin      : 50
            });
           $(".various").fancybox({
              closeClick  : false,
              openEffect	: 'elastic',
              closeEffect	: 'elastic',
              width		: '80%',
              closeBtn          : true,
              height		: '90%',
              type              :'iframe',
              'afterClose' : function() {
                parent.location.reload(true);
              },
              helpers   : {
                overlay : {closeClick: false}
              },
              'hideOnContentClick': true
            });
            $(".research").fancybox({
              closeClick  : true,
              openEffect	: 'elastic',
              closeEffect	: 'elastic',
              width		: '80%',
              height		: '90%',
              closeBtn          : true,
              //height		: '80%',
              type              :'iframe',
              helpers   : {
                overlay : {closeClick: false}
              }
            });
	});
</script>
<%# ruta_root = "http://pukara.ya.st"%>
<% ruta_root = "http://200.16.7.111"%>
<% ruta = ruta_root+'/cultural_heritage/cultures/'+@cultural_heritage_culture.id.to_s %>
<% titulo= '<meta property="og:title" content="[Pukara] '+@cultural_heritage_culture.name+']" >'%>
<%=  content_for(:title) {
  titulo.html_safe
} %>
<% url= '<meta property="og:url" content="'+ruta+'">'%>
<%=  content_for(:url) {
  url.html_safe
} %>
<%=  content_for(:type) {
  '<meta property="og:type" content="article">'.html_safe
} %>
<%imagen = '<meta property="og:image" content="'+ruta_root+'/images/pukara_logo2.png">'%>
<%=  content_for(:image) {
  imagen.html_safe
} %>
<%=  content_for(:site_map) {
  '<meta property="og:site_name" content="Pukara">'.html_safe
} %>
<!-- Fin Codigo feo para FB-->
<h1>Mostrar Cultura <%= @cultural_heritage_culture.name %></h1>
<% if flash[:notice] %>
    <div id="notice"><%= flash[:notice] %></div>
<% end %>
<div class="shadow">
  <fieldset class="column-left4">
    <fieldset id="agrupacion">
      <legend>Datos Básicos </legend>
      <p>
        <b>Nombre:</b>
        <%= @cultural_heritage_culture.name %>
      </p>

      <%if !@cultural_heritage_culture.period.blank?%>
        <p>
          <b>Periodo:</b>
          <%= link_to @cultural_heritage_culture.obj_period.name,{:controller=>"/cultural_heritage/periods",:action => 'show',:id => @cultural_heritage_culture.period},:title => @cultural_heritage_culture.obj_period.name %>          
        </p>
      <%end%>

      <%if !@cultural_heritage_culture.description.blank?%>
        <p>
          <b>Descripción:</b>
          <%= @cultural_heritage_culture.description %>
        </p>
      <%end%>
    </fieldset>

    <% if ! (@cultural_heritage_culture.location.blank?) %>
      <fieldset id="agrupacion">
        <legend>Ubicación </legend>
        <%if !@cultural_heritage_culture.location.blank?%>
          <p>
            <b>Locación:</b>
            <%= @cultural_heritage_culture.location %>
          </p>
        <%end%>
      </fieldset>
    <%end%>


    <% if ! (@cultural_heritage_culture.dlanguage.blank? and @cultural_heritage_culture.dreligion.blank? and @cultural_heritage_culture.dsocial.blank? and @cultural_heritage_culture.economic.blank?) %>
      <fieldset id="agrupacion">
        <legend>Datos Adicionales </legend>
        <%if !@cultural_heritage_culture.dlanguage.blank?%>
          <p>
            <b>Idioma:</b>
            <%= @cultural_heritage_culture.dlanguage %>
          </p>
        <%end%>

        <%if !@cultural_heritage_culture.dreligion.blank?%>
          <p>
            <b>Religión:</b>
            <%= @cultural_heritage_culture.dreligion %>
          </p>
        <%end%>

        <%if !@cultural_heritage_culture.dsocial.blank?%>
          <p>
            <b>Sociedad:</b>
            <%= @cultural_heritage_culture.dsocial %>
          </p>
        <%end%>

        <%if !@cultural_heritage_culture.economic.blank?%>
          <p>
            <b>Economia:</b>
            <%= @cultural_heritage_culture.economic %>
          </p>
        <%end%>
      <%end%>


    </fieldset>
  </fieldset>
  <fieldset class="column-right4">
    <fieldset id="agrupacion" width="200">
      <legend>Compartir</legend>
      <div class="fb-like" data-href="<%=ruta%>" data-send="false" data-layout="box_count" data-width="50" data-show-faces="false"></div>
      <br/><br/>
      <% l_url = litle_url(ruta)%>
      <a href="https://twitter.com/share" class="twitter-share-button" data-url="<%= l_url  %>" data-text="Sistema de Gestion de la Cultura Peruana Pukara" data-lang="es" data-hashtags="Pukara">Twittear</a>
      <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
      <br/><br/>
      <!-- Place this tag where you want the +1 button to render -->
      <g:plusone size="small"></g:plusone>
      <!-- Place this render call where appropriate -->
      <script type="text/javascript">
      window.___gcfg = {lang: 'es-419'};

      (function() {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'https://apis.google.com/js/plusone.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
      })();
      </script>
    </fieldset>
  </fieldset>
  <div id="lineaform"></div>
  <fieldset id="agrupacion" >
    <legend>Patrimonios por Cultura </legend>
    <% if !(@cultural_heritage_culture.list_cultural_heritages.blank?) %>
    <table class="paginated_table sorted_table" >
      <thead>
      <tr>
        <th>Nombre</th>
        <th>Grupo</th>
        <th>Sub Grupo</th>
      </tr>
    </thead>
    <tbody>
    <% @cultural_heritage_culture.list_cultural_heritages.each do |cultural_heritage| %>
      <tr>
        <td>
          <%if cultural_heritage.group == 1%>
           <%= link_to cultural_heritage.name_code,{:controller=>"/cultural_heritage/cultural_heritages",:action => 'show',:id => cultural_heritage.id},:title => cultural_heritage.description %>
          <%else%>
           <%= link_to cultural_heritage.name_code,{:controller=>"/cultural_heritage/cultural_heritage_properties",:action => 'show',:id => cultural_heritage.id},:title => cultural_heritage.description %>
          <%end%>
        </td>
        <td><%= cultural_heritage.obj_group.name %></td>
        <td><%= cultural_heritage.obj_subGroup.name %></td>
      </tr>
    <% end %>
    </tbody>
    </table>
    <% else %>
        <p> Ningún registro encontrado</p>
    <% end %>
  </fieldset>
 <div id="lineaform"></div>
  <!-- Aquí va gmaps -->
  <% if  !@cultural_heritage_culture.list_point.blank? %>
  <%= stylesheet_link_tag 'gmaps4rails' %>
  <div  style="width: 880px; height: 455px">    
    <fieldset id="agrupacion" style="width:620px; float: left">
      <legend>Ubicación</legend>      
      <%= gmaps({
          "map_options" => { "type" => "HYBRID", "center_longitude" => 180, "zoom" => 7, "auto_adjust" => true},
          "polygons"    => { "data" => @json }
        })
    %>    
    </fieldset>    
    <% if (user_signed_in? && ([2].include?(current_user.role))) %>
    <fieldset  id="agrupacion" style="width:210px; float: right">
      <legend>Georeferencia</legend>
      <%= link_to 'Mostrar puntos',{:action => 'list_points',:id => @cultural_heritage_culture.id},:class =>'various'%>
    </fieldset>
    <%end%>
  </div>
  <%else%>
    <% if (user_signed_in? && ([2].include?(current_user.role))) %>
    <fieldset  id="agrupacion" >
      <legend>Georeferencia</legend>
      <%= link_to 'Mostrar puntos',{:action => 'list_points',:id => @cultural_heritage_culture.id},:class =>'various'%>
    </fieldset>
    <%end%>
  <%end%>
  <br />
  <div id="lineaform"></div>
  <!-- Facebook Inicia aqui -->
  <div class="fb-comments" data-href="<%=ruta%>" data-num-posts="4" data-width="470"></div>

</div>
<% if (user_signed_in? && ([2,4].include?(current_user.role))) %>
<%= link_to 'Editar', edit_cultural_heritage_culture_path(@cultural_heritage_culture) %> |
<%end%>
<%= link_to 'Regresar', cultural_heritage_cultures_path %>
